package common

import (
	"io/ioutil"
	"log"

	"gopkg.in/yaml.v2"
)

type Config struct {
	Server struct {
		Host string `yaml:"host"`
		Port int    `yaml:"port"`
	}
}

var config Config

func init() {
	file, err := ioutil.ReadFile("config.yaml")
	if err != nil {
		log.Panic(err)
		return
	}
	err = yaml.Unmarshal(file, &config)
	if err != nil {
		log.Panic(err)
		return
	}
}

func GetConfig() Config {
	return config
}
